<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>阿德法</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="this is my page" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript" src="js/angular.min.js"></script>
</head>

<body>
	<div ng-app="searchApp" ng-controller="searchController">
		搜索key：<input type="text" name="key" ng-model="key" /> <input type="button" value='查询' ng-click="search()" />
		<div ng-repeat="x in searchData">
			<a href="{{x.url}}"><font size="5"><titl ng-bind-html="x.title | trustHtml"></titl><br /></font></a>
			<desp ng-bind-html="x.description | trustHtml"></desp>
			<hr />
		</div>
	</div>
</body>
<script type="text/javascript">  
     var searchApp=angular.module("searchApp",[]);  
     searchApp.controller("searchController",function($scope,$http,$sce){  
         $scope.search=function(){  
            $http({  
               method:"GET",  
               url:"search?key="+$scope.key  
            }).then(function(res){  
                var d=res.data;  
                $scope.searchData=d;  
            },function(res){  
                alert("查询失败"+res.status+"-"+res.statusText);  
            });  
         }  
     });  
     //因为angular会自动将html内容转义 需要添加一个过滤器 表示信任  
     searchApp.filter("trustHtml",function($sce){  
        return function(val){  
             return $sce.trustAsHtml(val);  
        }  
     });  
  </script>
</html>
